Change in openvpn[master]: mbedtls: avoid warning with GCC 13+
A message that is not in the archive (sent off-list or not yet received): gerrit.1711377047000.If0dcdde30879fd6185efb2ad31399c1629c04d22@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
to review the following change.
Change subject: mbedtls: avoid warning with GCC 13+
......................................................................
mbedtls: avoid warning with GCC 13+
crypto_mbedtls.c:568:1: error:
conflicting types for ‘cipher_ctx_init’ due to enum/integer mismatch;
have ‘void(mbedtls_cipher_context_t *, const uint8_t *, const char *, const mbedtls_operation_t)’ [...] [-Werror=enum-int-mismatch]
crypto_backend.h:341:6: note:
previous declaration of ‘cipher_ctx_init’ with type
‘void(cipher_ctx_t *, const uint8_t *, const char *, int)’ [...]
Previous compiler versions did not complain.
---
M src/openvpn/crypto_mbedtls.c
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/548/1
src/openvpn/crypto_mbedtls.c +2 -1
@@ -566,11 +566,12 @@void cipher_ctx_init (mbedtls_cipher_context_t *ctx,const uint8_t *key, -const char *ciphername,const mbedtls_operation_t operation) +const char *ciphername,int enc) {ASSERT (NULL != ciphername &&NULL != ctx);CLEAR (*ctx); +const mbedtls_operation_t operation = (mbedtls_operation_t )enc;const mbedtls_cipher_info_t *kt =cipher_get (ciphername);ASSERT (kt);size_t key_bitlen =mbedtls_cipher_info_get_key_bitlen (kt);
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/548?usp=email )
Change subject: mbedtls: avoid warning with GCC 13+
......................................................................
Patch Set 1: Code-Review-1
(1 comment)
Patchset:
PS1:
I would rather have a typedef in crypto_mbedtls.h and crypto_openssl.h that does something like
typedef mbedtls_operation_t encryption_operation_t;
and then use that type consistently in the API. Do you want to take a stab at that or should I take over?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 27 Mar 2024 09:30:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
[Openvpn-devel] [S] Change in openvpn[master]: crypto_backend: fix type of enc parameter
In reply to a message not in the archiveAttention is currently required from: flichtenheld, plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review-1 by plaisthos
Change subject: crypto_backend: fix type of enc parameter
......................................................................
crypto_backend: fix type of enc parameter
We had parts of a abstraction, but it wasn't consistent. GCC 13 now complains about the type mismatch with mbedtls now:
crypto_mbedtls.c:568:1: error:
conflicting types for ‘cipher_ctx_init’ due to enum/integer mismatch;
have ‘void(mbedtls_cipher_context_t *, const uint8_t *, const char *, const mbedtls_operation_t)’ [...] [-Werror=enum-int-mismatch]
crypto_backend.h:341:6: note:
previous declaration of ‘cipher_ctx_init’ with type
‘void(cipher_ctx_t *, const uint8_t *, const char *, int)’ [...]
Previous compiler versions did not complain.
---
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
M src/openvpn/crypto_openssl.h
4 files changed, 8 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/548/2
src/openvpn/crypto_backend.h +2 -2
@@ -336,10 +336,10 @@* @param key Buffer containing the key to use * @param ciphername Ciphername of the cipher to use * @param enc Whether to encrypt or decrypt (either -* \c MBEDTLS_OP_ENCRYPT or \c MBEDTLS_OP_DECRYPT). +* \c OPENVPN_OP_ENCRYPT or \c OPENVPN_OP_DECRYPT). */ void cipher_ctx_init (cipher_ctx_t *ctx,const uint8_t *key, -const char *cipername,int enc); +const char *cipername,crypto_operation_t enc);/** * Returns the size of the IV used by the cipher, in bytes, or 0 if no IV is
src/openvpn/crypto_mbedtls.c +2 -1
@@ -566,11 +566,12 @@void cipher_ctx_init (mbedtls_cipher_context_t *ctx,const uint8_t *key, -const char *ciphername,const mbedtls_operation_t operation) +const char *ciphername,int enc) {ASSERT (NULL != ciphername &&NULL != ctx);CLEAR (*ctx); +const mbedtls_operation_t operation = (mbedtls_operation_t )enc;const mbedtls_cipher_info_t *kt =cipher_get (ciphername);ASSERT (kt);size_t key_bitlen =mbedtls_cipher_info_get_key_bitlen (kt);
src/openvpn/crypto_mbedtls.h +2 -0
@@ -63,6 +63,8 @@/** Cipher is in GCM mode */ #define OPENVPN_MODE_GCM MBEDTLS_MODE_GCM +typedef mbedtls_operation_t crypto_operation_t ; +/** Cipher should encrypt */ #define OPENVPN_OP_ENCRYPT MBEDTLS_ENCRYPT
src/openvpn/crypto_openssl.h +2 -0
@@ -85,6 +85,8 @@/** Cipher is in GCM mode */ #define OPENVPN_MODE_GCM EVP_CIPH_GCM_MODE +typedef int crypto_operation_t ; +/** Cipher should encrypt */ #define OPENVPN_OP_ENCRYPT 1
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
[Openvpn-devel] [S] Change in openvpn[master]: crypto_backend: fix type of enc parameter
In reply to a message not in the archiveAttention is currently required from: flichtenheld, plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
to look at the new patch set (#3).
Change subject: crypto_backend: fix type of enc parameter
......................................................................
crypto_backend: fix type of enc parameter
We had parts of a abstraction, but it wasn't consistent. GCC 13 now complains about the type mismatch with mbedtls now:
crypto_mbedtls.c:568:1: error:
conflicting types for ‘cipher_ctx_init’ due to enum/integer mismatch;
have ‘void(mbedtls_cipher_context_t *, const uint8_t *, const char *, const mbedtls_operation_t)’ [...] [-Werror=enum-int-mismatch]
crypto_backend.h:341:6: note:
previous declaration of ‘cipher_ctx_init’ with type
‘void(cipher_ctx_t *, const uint8_t *, const char *, int)’ [...]
Previous compiler versions did not complain.
v2:
- clean solution instead of quick solution. Fix the actual API definition
---
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
M src/openvpn/crypto_openssl.c
M src/openvpn/crypto_openssl.h
5 files changed, 9 insertions(+), 5 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/548/3
src/openvpn/crypto_backend.h +2 -2
@@ -336,10 +336,10 @@* @param key Buffer containing the key to use * @param ciphername Ciphername of the cipher to use * @param enc Whether to encrypt or decrypt (either -* \c MBEDTLS_OP_ENCRYPT or \c MBEDTLS_OP_DECRYPT). +* \c OPENVPN_OP_ENCRYPT or \c OPENVPN_OP_DECRYPT). */ void cipher_ctx_init (cipher_ctx_t *ctx,const uint8_t *key, -const char *cipername,int enc); +const char *cipername,crypto_operation_t enc);/** * Returns the size of the IV used by the cipher, in bytes, or 0 if no IV is
src/openvpn/crypto_mbedtls.c +2 -2
@@ -566,7 +566,7 @@void cipher_ctx_init (mbedtls_cipher_context_t *ctx,const uint8_t *key, -const char *ciphername,const mbedtls_operation_t operation) +const char *ciphername,crypto_operation_t enc) {ASSERT (NULL != ciphername &&NULL != ctx);CLEAR (*ctx);
@@ -580,7 +580,7 @@msg (M_FATAL ,"mbed TLS cipher context init #1" ); } -if (!mbed_ok (mbedtls_cipher_setkey (ctx, key, (int )key_bitlen, operation))) +if (!mbed_ok (mbedtls_cipher_setkey (ctx, key, (int )key_bitlen, enc))) {msg (M_FATAL ,"mbed TLS cipher set key" ); }
src/openvpn/crypto_mbedtls.h +2 -0
@@ -63,6 +63,8 @@/** Cipher is in GCM mode */ #define OPENVPN_MODE_GCM MBEDTLS_MODE_GCM +typedef mbedtls_operation_t crypto_operation_t ; +/** Cipher should encrypt */ #define OPENVPN_OP_ENCRYPT MBEDTLS_ENCRYPT
src/openvpn/crypto_openssl.c +1 -1
@@ -840,7 +840,7 @@void cipher_ctx_init (EVP_CIPHER_CTX *ctx,const uint8_t *key, -const char *ciphername,int enc) +const char *ciphername,crypto_operation_t enc) {ASSERT (NULL != ciphername &&NULL != ctx);evp_cipher_type *kt =cipher_get (ciphername);
src/openvpn/crypto_openssl.h +2 -0
@@ -85,6 +85,8 @@/** Cipher is in GCM mode */ #define OPENVPN_MODE_GCM EVP_CIPH_GCM_MODE +typedef int crypto_operation_t ; +/** Cipher should encrypt */ #define OPENVPN_OP_ENCRYPT 1
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
[Openvpn-devel] [S] Change in openvpn[master]: crypto_backend: fix type of enc parameter
In reply to a message not in the archiveAttention is currently required from: flichtenheld, plaisthos.
ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/548?usp=email )
Change subject: crypto_backend: fix type of enc parameter
......................................................................
Patch Set 3:
(2 comments)
Patchset:
PS3:
Thanks for introducing the typedef - this looks much cleaner, as Arne also suggested. However, I have a nit pick about the arg naming.
File src/openvpn/crypto_mbedtls.c:
http://gerrit.openvpn.net/c/openvpn/+/548/comment/f5ffc802_2b16c413 :
PS3, Line 569: const char *ciphername, crypto_operation_t enc)
may I argue that the name "operation" (or just "op") is more appropriate as this is not a bool (encrypt or not encrypt), but rather an enum being assigned some op?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 27 Mar 2024 13:24:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
[Openvpn-devel] [S] Change in openvpn[master]: crypto_backend: fix type of enc parameter
In reply to a message not in the archiveAttention is currently required from: flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/548?usp=email )
Change subject: crypto_backend: fix type of enc parameter
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 27 Mar 2024 13:32:50 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
[Openvpn-devel] [S] Change in openvpn[master]: crypto_backend: fix type of enc parameter
In reply to a message not in the archiveAttention is currently required from: flichtenheld, ordex.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/548?usp=email )
Change subject: crypto_backend: fix type of enc parameter
......................................................................
Patch Set 3:
(1 comment)
File src/openvpn/crypto_mbedtls.c:
http://gerrit.openvpn.net/c/openvpn/+/548/comment/4014ab83_686bac9b :
PS3, Line 569: const char *ciphername, crypto_operation_t enc)
Quoted 1 line
may I argue that the name "operation" (or just "op") is more appropriate as this is not a bool (encr […]
It matches the OpenSSL API, it also uses int enc ...
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Wed, 27 Mar 2024 13:34:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment
[Openvpn-devel] [S] Change in openvpn[master]: crypto_backend: fix type of enc parameter
In reply to a message not in the archiveAttention is currently required from: ordex, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/548?usp=email )
Change subject: crypto_backend: fix type of enc parameter
......................................................................
Patch Set 3:
(1 comment)
File src/openvpn/crypto_mbedtls.c:
http://gerrit.openvpn.net/c/openvpn/+/548/comment/dc2be5d0_47f83eb9 :
PS3, Line 569: const char *ciphername, crypto_operation_t enc)
Quoted 1 line
It matches the OpenSSL API, it also uses int enc ...
Also, in practice it is a boolean. The third state is only for indicating error when used as a return value.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Wed, 27 Mar 2024 15:19:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment
[Openvpn-devel] [S] Change in openvpn[master]: crypto_backend: fix type of enc parameter
In reply to a message not in the archiveAttention is currently required from: flichtenheld, plaisthos.
ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/548?usp=email )
Change subject: crypto_backend: fix type of enc parameter
......................................................................
Patch Set 3:
(1 comment)
File src/openvpn/crypto_mbedtls.c:
http://gerrit.openvpn.net/c/openvpn/+/548/comment/c7af8f42_1c7d88cd :
PS3, Line 569: const char *ciphername, crypto_operation_t enc)
Quoted 1 line
Also, in practice it is a boolean. […]
still dirty if you ask me, but it's a nit pick
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 27 Mar 2024 15:25:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment
[Openvpn-devel] [S] Change in openvpn[master]: crypto_backend: fix type of enc parameter
In reply to a message not in the archiveAttention is currently required from: ordex, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/548?usp=email )
Change subject: crypto_backend: fix type of enc parameter
......................................................................
Patch Set 3:
(1 comment)
File src/openvpn/crypto_mbedtls.c:
http://gerrit.openvpn.net/c/openvpn/+/548/comment/54a6d210_d1fef5e2 :
PS3, Line 569: const char *ciphername, crypto_operation_t enc)
Quoted 1 line
still dirty if you ask me, but it's a nit pick
Acknowledged
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Wed, 27 Mar 2024 16:25:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment
PATCH v3 1/1 crypto_backend: fix type of enc parameter
In reply to a message not in the archiveWe had parts of a abstraction, but it wasn't consistent. GCC 13 now complains about the type mismatch with mbedtls now:
crypto_mbedtls.c:568:1: error:
conflicting types for ‘cipher_ctx_init’ due to enum/integer mismatch;
have ‘void(mbedtls_cipher_context_t *, const uint8_t *, const char *, const mbedtls_operation_t)’ [...] [-Werror=enum-int-mismatch]
crypto_backend.h:341:6: note:
previous declaration of ‘cipher_ctx_init’ with type
‘void(cipher_ctx_t *, const uint8_t *, const char *, int)’ [...]
Previous compiler versions did not complain.
v2:
- clean solution instead of quick solution. Fix the actual API definition
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/548
This mail reflects revision 3 of this Change.
Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>
src/openvpn/crypto_backend.h +2 -2
@@ -336,10 +336,10 @@* @param key Buffer containing the key to use * @param ciphername Ciphername of the cipher to use * @param enc Whether to encrypt or decrypt (either -* \c MBEDTLS_OP_ENCRYPT or \c MBEDTLS_OP_DECRYPT). +* \c OPENVPN_OP_ENCRYPT or \c OPENVPN_OP_DECRYPT). */ void cipher_ctx_init (cipher_ctx_t *ctx,const uint8_t *key, -const char *cipername,int enc); +const char *cipername,crypto_operation_t enc);/** * Returns the size of the IV used by the cipher, in bytes, or 0 if no IV is
src/openvpn/crypto_mbedtls.c +2 -2
@@ -566,7 +566,7 @@void cipher_ctx_init (mbedtls_cipher_context_t *ctx,const uint8_t *key, -const char *ciphername,const mbedtls_operation_t operation) +const char *ciphername,crypto_operation_t enc) {ASSERT (NULL != ciphername &&NULL != ctx);CLEAR (*ctx);
@@ -580,7 +580,7 @@msg (M_FATAL ,"mbed TLS cipher context init #1" ); } -if (!mbed_ok (mbedtls_cipher_setkey (ctx, key, (int )key_bitlen, operation))) +if (!mbed_ok (mbedtls_cipher_setkey (ctx, key, (int )key_bitlen, enc))) {msg (M_FATAL ,"mbed TLS cipher set key" ); }
src/openvpn/crypto_mbedtls.h +2 -0
@@ -63,6 +63,8 @@/** Cipher is in GCM mode */ #define OPENVPN_MODE_GCM MBEDTLS_MODE_GCM +typedef mbedtls_operation_t crypto_operation_t ; +/** Cipher should encrypt */ #define OPENVPN_OP_ENCRYPT MBEDTLS_ENCRYPT
src/openvpn/crypto_openssl.c +1 -1
@@ -840,7 +840,7 @@void cipher_ctx_init (EVP_CIPHER_CTX *ctx,const uint8_t *key, -const char *ciphername,int enc) +const char *ciphername,crypto_operation_t enc) {ASSERT (NULL != ciphername &&NULL != ctx);evp_cipher_type *kt =cipher_get (ciphername);
src/openvpn/crypto_openssl.h +2 -0
@@ -85,6 +85,8 @@/** Cipher is in GCM mode */ #define OPENVPN_MODE_GCM EVP_CIPH_GCM_MODE +typedef int crypto_operation_t ; +/** Cipher should encrypt */ #define OPENVPN_OP_ENCRYPT 1
[Openvpn-devel] [PATCH applied] Re: crypto_backend: fix type of enc parameter
Lightly tested on a FreeBSD/MbedTLS 2.28.7, resulting code still works :-)
Your patch has been applied to the master branch.
commit 4d907bf46a470ccbd2940b9ecb64d6502d9d86bf
Author: Frank Lichtenheld Date: Wed Mar 27 17:26:21 2024 +0100
crypto_backend: fix type of enc parameter
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28498.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Re: [Openvpn-devel] [PATCH applied] Re: crypto_backend: fix type of enc parameter
Hi,
Quoted 7 lines · Gert Doering
Lightly tested on a FreeBSD/MbedTLS 2.28.7, resulting code still works :-)
Your patch has been applied to the master branch.
commit
4d907bf46a470ccbd2940b9ecb64d6502d9d86bfAuthor: Frank Lichtenheld Date: Wed Mar 27 17:26:21 2024 +0100
Recent pushes to release/2.6 have caused buildbot breakage on mbedTLS builds on "very recent" Linux systems (newer GCC). The patch referenced fixes this in master already.
Given that it's a quite non-intrusive patch (replacing "int" with a typedef mapped to the appropriate mbedTLS and OpenSSL [int] type) we've decided to file it under "long term compat" and so it goes into release/2.6 as well now :-)
commit a421e94344aa2a2f15575eb5c6d57af48d669599 (release/2.6)
Author: Frank Lichtenheld <[email protected]...> Date: Wed Mar 27 17:26:21 2024 +0100
crypto_backend: fix type of enc parameter
Buildbot and Github claim "warnings gone, compiles and tests fine" :-)
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...[Openvpn-devel] [S] Change in openvpn[master]: crypto_backend: fix type of enc parameter
In reply to a message not in the archiveAttention is currently required from: flichtenheld, ordex.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/548?usp=email )
Change subject: crypto_backend: fix type of enc parameter
......................................................................
Patch Set 3:
(1 comment)
File src/openvpn/crypto_mbedtls.c:
http://gerrit.openvpn.net/c/openvpn/+/548/comment/997ae8f4_a9d0ede6 :
PS3, Line 569: const char *ciphername, crypto_operation_t enc)
Quoted 1 line
Acknowledged
There is a -1 state in OpenSSL that mean "don't change when reinitialising" that we do not use.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Wed, 27 Mar 2024 18:44:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment
[Openvpn-devel] [S] Change in openvpn[master]: crypto_backend: fix type of enc parameter
In reply to a message not in the archivecron2 has uploaded a new patch set (#4) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/548?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by plaisthos
Change subject: crypto_backend: fix type of enc parameter
......................................................................
crypto_backend: fix type of enc parameter
We had parts of a abstraction, but it wasn't consistent. GCC 13 now complains about the type mismatch with mbedtls now:
crypto_mbedtls.c:568:1: error:
conflicting types for ‘cipher_ctx_init’ due to enum/integer mismatch;
have ‘void(mbedtls_cipher_context_t *, const uint8_t *, const char *, const mbedtls_operation_t)’ [...] [-Werror=enum-int-mismatch]
crypto_backend.h:341:6: note:
previous declaration of ‘cipher_ctx_init’ with type
‘void(cipher_ctx_t *, const uint8_t *, const char *, int)’ [...]
Previous compiler versions did not complain.
v2:
- clean solution instead of quick solution. Fix the actual API definition
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28498.html
---
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
M src/openvpn/crypto_openssl.c
M src/openvpn/crypto_openssl.h
5 files changed, 9 insertions(+), 5 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/48/548/4
src/openvpn/crypto_backend.h +2 -2
@@ -336,10 +336,10 @@* @param key Buffer containing the key to use * @param ciphername Ciphername of the cipher to use * @param enc Whether to encrypt or decrypt (either -* \c MBEDTLS_OP_ENCRYPT or \c MBEDTLS_OP_DECRYPT). +* \c OPENVPN_OP_ENCRYPT or \c OPENVPN_OP_DECRYPT). */ void cipher_ctx_init (cipher_ctx_t *ctx,const uint8_t *key, -const char *cipername,int enc); +const char *cipername,crypto_operation_t enc);/** * Returns the size of the IV used by the cipher, in bytes, or 0 if no IV is
src/openvpn/crypto_mbedtls.c +2 -2
@@ -566,7 +566,7 @@void cipher_ctx_init (mbedtls_cipher_context_t *ctx,const uint8_t *key, -const char *ciphername,const mbedtls_operation_t operation) +const char *ciphername,crypto_operation_t enc) {ASSERT (NULL != ciphername &&NULL != ctx);CLEAR (*ctx);
@@ -580,7 +580,7 @@msg (M_FATAL ,"mbed TLS cipher context init #1" ); } -if (!mbed_ok (mbedtls_cipher_setkey (ctx, key, (int )key_bitlen, operation))) +if (!mbed_ok (mbedtls_cipher_setkey (ctx, key, (int )key_bitlen, enc))) {msg (M_FATAL ,"mbed TLS cipher set key" ); }
src/openvpn/crypto_mbedtls.h +2 -0
@@ -63,6 +63,8 @@/** Cipher is in GCM mode */ #define OPENVPN_MODE_GCM MBEDTLS_MODE_GCM +typedef mbedtls_operation_t crypto_operation_t ; +/** Cipher should encrypt */ #define OPENVPN_OP_ENCRYPT MBEDTLS_ENCRYPT
src/openvpn/crypto_openssl.c +1 -1
@@ -840,7 +840,7 @@void cipher_ctx_init (EVP_CIPHER_CTX *ctx,const uint8_t *key, -const char *ciphername,int enc) +const char *ciphername,crypto_operation_t enc) {ASSERT (NULL != ciphername &&NULL != ctx);evp_cipher_type *kt =cipher_get (ciphername);
src/openvpn/crypto_openssl.h +2 -0
@@ -85,6 +85,8 @@/** Cipher is in GCM mode */ #define OPENVPN_MODE_GCM EVP_CIPH_GCM_MODE +typedef int crypto_operation_t ; +/** Cipher should encrypt */ #define OPENVPN_OP_ENCRYPT 1
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-MessageType: newpatchset
[Openvpn-devel] [S] Change in openvpn[master]: crypto_backend: fix type of enc parameter
In reply to a message not in the archivecron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/548?usp=email )
Change subject: crypto_backend: fix type of enc parameter
......................................................................
crypto_backend: fix type of enc parameter
We had parts of a abstraction, but it wasn't consistent. GCC 13 now complains about the type mismatch with mbedtls now:
crypto_mbedtls.c:568:1: error:
conflicting types for ‘cipher_ctx_init’ due to enum/integer mismatch;
have ‘void(mbedtls_cipher_context_t *, const uint8_t *, const char *, const mbedtls_operation_t)’ [...] [-Werror=enum-int-mismatch]
crypto_backend.h:341:6: note:
previous declaration of ‘cipher_ctx_init’ with type
‘void(cipher_ctx_t *, const uint8_t *, const char *, int)’ [...]
Previous compiler versions did not complain.
v2:
- clean solution instead of quick solution. Fix the actual API definition
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg28498.html
---
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
M src/openvpn/crypto_openssl.c
M src/openvpn/crypto_openssl.h
5 files changed, 9 insertions(+), 5 deletions(-)
src/openvpn/crypto_backend.h +2 -2
@@ -336,10 +336,10 @@* @param key Buffer containing the key to use * @param ciphername Ciphername of the cipher to use * @param enc Whether to encrypt or decrypt (either -* \c MBEDTLS_OP_ENCRYPT or \c MBEDTLS_OP_DECRYPT). +* \c OPENVPN_OP_ENCRYPT or \c OPENVPN_OP_DECRYPT). */ void cipher_ctx_init (cipher_ctx_t *ctx,const uint8_t *key, -const char *cipername,int enc); +const char *cipername,crypto_operation_t enc);/** * Returns the size of the IV used by the cipher, in bytes, or 0 if no IV is
src/openvpn/crypto_mbedtls.c +2 -2
@@ -566,7 +566,7 @@void cipher_ctx_init (mbedtls_cipher_context_t *ctx,const uint8_t *key, -const char *ciphername,const mbedtls_operation_t operation) +const char *ciphername,crypto_operation_t enc) {ASSERT (NULL != ciphername &&NULL != ctx);CLEAR (*ctx);
@@ -580,7 +580,7 @@msg (M_FATAL ,"mbed TLS cipher context init #1" ); } -if (!mbed_ok (mbedtls_cipher_setkey (ctx, key, (int )key_bitlen, operation))) +if (!mbed_ok (mbedtls_cipher_setkey (ctx, key, (int )key_bitlen, enc))) {msg (M_FATAL ,"mbed TLS cipher set key" ); }
src/openvpn/crypto_mbedtls.h +2 -0
@@ -63,6 +63,8 @@/** Cipher is in GCM mode */ #define OPENVPN_MODE_GCM MBEDTLS_MODE_GCM +typedef mbedtls_operation_t crypto_operation_t ; +/** Cipher should encrypt */ #define OPENVPN_OP_ENCRYPT MBEDTLS_ENCRYPT
src/openvpn/crypto_openssl.c +1 -1
@@ -840,7 +840,7 @@void cipher_ctx_init (EVP_CIPHER_CTX *ctx,const uint8_t *key, -const char *ciphername,int enc) +const char *ciphername,crypto_operation_t enc) {ASSERT (NULL != ciphername &&NULL != ctx);evp_cipher_type *kt =cipher_get (ciphername);
src/openvpn/crypto_openssl.h +2 -0
@@ -85,6 +85,8 @@/** Cipher is in GCM mode */ #define OPENVPN_MODE_GCM EVP_CIPH_GCM_MODE +typedef int crypto_operation_t ; +/** Cipher should encrypt */ #define OPENVPN_OP_ENCRYPT 1
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/548?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If0dcdde30879fd6185efb2ad31399c1629c04d22
Gerrit-Change-Number: 548
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-MessageType: merged